{extend name="./template/default/pub/base.html" /}
{block name="seo"}
<title>vip-{$site_name}</title>
{/block}
{block name="content"}
{include file="./template/default/pub/top4.html" /}
<div style="position: fixed;top: 46px;width: 100%">
    <div class="title-1" >VIP套餐<a href="#" class="title-1-right">推广赢VIP</a></div>
    <ul class="recharge-set">
        {volist name="vips" id="vo"}
        <li data-val="{$vo.month}">
            <div class="recharge-set-info">
                <p class="recharge-set-title">{$vo.month}个月VIP</p>
                <p class="recharge-set-tip">每月￥{:floor($vo.price/$vo.month)}</p>
            </div>
            <span class="recharge-set-right"> ￥{$vo.price} </span>
        </li>
        {/volist}
    </ul>
    <form id="vipForm">
        <input type="hidden" name="month" id="month" value="">
    </form>
    <a class="recharge-fix-btn" href="javascript:void(0);" onclick="formSub();">确认开通</a>
    <div class="toast" style="display:none;"></div>
</div>

<script>
    $('.recharge-set li').click(function () {
        $(this).addClass('active').siblings().removeClass('active');
        $('#month').val($(this).attr('data-val'));
    })

    function formSub() {
        var month = $('#month').val();
        if (month == '') {
            ShowDialog('请选择一个选项');
        } else {
            $.post({
                url: '/vip',
                data: {month: month},
                success: function (res) {
                    ShowDialog(res.msg);
                    if (res.err == 0) {
                        setTimeout(function () {
                            location.href = '/ucenter';
                        }, 1000);
                    } else if (res.err == 1) {
                        setTimeout(function () {
                            location.href = '/charge';
                        }, 1000);
                    }
                }
            })
        }

    }
</script>
{/block}